package com.zhou.test.spring.secrity.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xianfeng
 * @date 2023/5/13 8:30
 */
@RestController
public class MyController {

    @PreAuthorize("hasRole('ADMIN')")
    @RequestMapping("/test1")
    public String test1(Model model) {
        return "hasRole('ADMIN')";
    }

    @PreAuthorize("hasAuthority('system')")
    @RequestMapping("/test2")
    public String test2(Model model) {
        return "hasAuthority('system')";
    }


    @RequestMapping("/test3")
    public String test3(Model model) {
        return "hasAuthority('system')";
    }
}
